package com.pie4cloud.pie.job.executor.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pie4cloud.pie.common.core.util.R;
import com.pie4cloud.pie.common.log.annotation.SysLog;
import com.pie4cloud.pie.job.executor.entity.PlayBillMonitorEntity;
import com.pie4cloud.pie.job.executor.service.PlayBillMonitorService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("/playbillMonitor" )
public class PlayBillMonitorController {
	private final PlayBillMonitorService playBillMonitorService;


	@ApiOperation(value = "分页查询", notes = "分页查询")
	@GetMapping("/page" )
	public R getTDataJobInfoPage(Page page, PlayBillMonitorEntity playBillMonitorEntity) {
		return R.ok(playBillMonitorService.page(page,playBillMonitorEntity));
	}

	/**
	 * 通过id查询
	 * @param id id
	 * @return R
	 */
	@ApiOperation(value = "通过id查询", notes = "通过id查询")
	@GetMapping("/{id}" )
	public R getById(@PathVariable("id" ) Long id) {
		return R.ok(playBillMonitorService.getById(id));
	}

/*	@ApiOperation(value = "通过id查询", notes = "通过id查询")
	@GetMapping("/remote/{id}" )
	@Inner
	public R getRemoteById(@PathVariable("id" ) Integer id) {
		return R.ok(playBillMonitorService.getById(id));
	}*/

	/**
	 * 新增
	 * @param  playBillMonitorEntity
	 * @return R
	 */
	@ApiOperation(value = "新增", notes = "新增")
	@SysLog("新增" )
	@PostMapping
	public R save(@RequestBody PlayBillMonitorEntity playBillMonitorEntity) {
		return R.ok(playBillMonitorService.save(playBillMonitorEntity));
	}

	/**
	 * 修改
	 * @param playBillMonitorEntity
	 * @return R
	 */
	@ApiOperation(value = "修改", notes = "修改")
	@SysLog("修改" )
	@PutMapping
	public R updateById(@RequestBody PlayBillMonitorEntity playBillMonitorEntity) {
		return R.ok(playBillMonitorService.update(playBillMonitorEntity));
	}

	/**
	 * 通过id删除
	 * @param id id
	 * @return R
	 */
	@ApiOperation(value = "通过id删除", notes = "通过id删除")
	@SysLog("通过id删除" )
	@DeleteMapping("/{id}" )
	public R removeById(@PathVariable Long id) {
		return R.ok(playBillMonitorService.removeById(id));
	}



}
